<template>
  <el-dialog :title="info.title" :visible.sync="visible" append-to-body center width="460px" :before-close="handleCancel">
    <el-form ref="formDate" label-suffix=":" label-width="100px" :model="form">
      <el-row>
        <el-col :span="24">
          <el-form-item label="记录人" style="width: 100%" class="tal">
            {{form.state_info}}
          </el-form-item>
        </el-col>
        <el-col :span="24">
          <el-form-item label="备注" class="tal">
            {{form.progress_remark}}
          </el-form-item>
        </el-col>
      </el-row>
      <el-row>
        <el-col :span="24">
          <div class="fr mt10">
            <el-button size="small" @click="handleCancel()">取 消</el-button>
          </div>
        </el-col>
      </el-row>
    </el-form>
  </el-dialog>
</template>

<script>

export default {
  inject: ['app'],
  props: {
    info: {
      type: Object,
      default: null
    },
    getData: {
      type: Function,
      default: function() {}
    }
  },
  data() {
    return {
      form: {},
      visible: false
    }
  },
  watch: {
    visible(val) {
      if (val) {
        this.form = this.info.edit
        let state = this.form.state
        let state_info = ''
        if(state === 0) {
          state_info = '进展中'
        } else if (state === 1) {
          state_info = '已成交'
        } else if (state === 2) {
          state_info = '未成交'
        }
        this.$set(this.form, 'state_info', state_info)
      }
    },
    getData: {
      type: Function,
      default: function() {}
    }
  },
  mounted() {
  },
  methods: {
    handleCancel(done) {
      if (this.$refs['formDate']) this.$refs['formDate'].resetFields()
      if (done && typeof done === Function) {
        done()
      } else {
        this.visible = false
      }
    }
  }
}
</script>

<style>

</style>
